When BagOStuff::lock() was called, it called $this->add() with only
two parameters, the key and the timeout. But BagOStuff::add() takes
three parameters (key, value, timeout), so all locks got an infinite
timeout.
Change-Id: I82bed11b0b799f2cda13a8a0bd0cd94908b6ce8e
*/
public function lock( $key, $timeout = 60 ) {
$timestamp = microtime( true ); // starting UNIX timestamp
- if ( $this->add( "{$key}:lock", $timeout ) ) {
+ if ( $this->add( "{$key}:lock", 1, $timeout ) ) {
return true;
}
$sleep *= 2;
}
usleep( $sleep ); // back off
- $locked = $this->add( "{$key}:lock", $timeout );
+ $locked = $this->add( "{$key}:lock", 1, $timeout );
} while ( !$locked );
return $locked;